/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package common;

import java.text.NumberFormat;
import javax.swing.table.DefaultTableCellRenderer;

/**
 *
 * @author Sony
 */
public class CurrencyRenderer extends DefaultTableCellRenderer {

    public CurrencyRenderer() {
        super();
        setHorizontalAlignment(RIGHT);
    }

    @Override
    protected void setValue(Object value) {
        if ((value != null) && (value instanceof Number)) {
            Number numberValue = (Number) value;
            NumberFormat nFormat = NumberFormat.getCurrencyInstance();
            value = nFormat.format(numberValue.floatValue());
        }

        super.setValue(value); //To change body of generated methods, choose Tools | Templates.
    }
}
